package pdai.jvm.a_深浅拷贝;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Major m = new Major("1111", "2222");
        Student student1 = new Student("1", "aa", m);

        Student student2 = (Student) student1.clone();
        System.out.println(student1.equals(student2));
        System.out.println(student1);
        System.out.println(student2);
        System.out.println("\n");

        // 修改student1的值类型字段
        student1.setStudentId("stuid");

        // 修改student1的引用类型字段
        m.setMajorName("电子信息工程");
        m.setMajorId("5555");

        System.out.println(student1);
        System.out.println(student2);
    }
}
